package Model;

import java.io.Serializable;

import Messaging.Notification;
import Messaging.NotificationManager;

/* 
 * @author Mark de Lira
 */

public class UpgradeablePropertyLevel4 extends UpgradeablePropertyState implements Serializable
{
	
	private static UpgradeablePropertyLevel4 INSTANCE = null;
	final static long serialVersionUID = 226;
	
	protected UpgradeablePropertyLevel4() 
	{

	}
	
	public static UpgradeablePropertyState Instance() 
	{
		if (INSTANCE == null) 
		{
			INSTANCE = new UpgradeablePropertyLevel4();
		}
		
		return INSTANCE;
	}
	
	public void landOn(Player player, PropertySpace property)
	{
		property.getOwner().collectRent(property.getRentValues()[4], player);
	}
	
	protected void renovate(UpgradeablePropertySpace p)
	{
		p.changeState(UpgradeablePropertyLevel5.Instance());
		NotificationManager.getInstance().notifyObservers
		(Notification.UPDATE_PROPERTIES, new Player(p.getOwner()));
	}
	
	protected void downgrade(UpgradeablePropertySpace p)
	{
		p.changeState(UpgradeablePropertyLevel3.Instance());
		NotificationManager.getInstance().notifyObservers
		(Notification.UPDATE_PROPERTIES, new Player(p.getOwner()));
	}

	protected boolean isUpgradeable(UpgradeablePropertySpace p)
	{
		return p.getOwner().monopolyUpgradeValid(p);
	}
	
	protected boolean isDowngradeable(UpgradeablePropertySpace p) 
	{
		return p.getOwner().monopolyDowngradeValid(p);
	}
	
	protected String getNameAndStatus() 
	{
		return " (Level 4)";
	}
	
	public int getLevel() 
	{
		return 4;
	}
	
	public String toString()
	{
		return "UpgradeablePropertyLevel4";
	}
}
